#!/user/bin/env python
# -*- coding:utf-8 -*-
#/home/zc/workspace/tinyfeet/trunk/src/controllers/deftfeet.py

'''

删除：
 {
            "tfid":1121,
            "srckey":"8c74fb7a3f281d601d546f3dfc526cf5e717a5abxjguteqh"
            }
            
Created on 2011-10-25

@author: zc

changeLog:
2011-11-22 返回增加tfid

'''

import web
import simplejson
from dbhandle.mysqldb import mysqldb 
from checkkey import checkkey
from config.sqlmap import SQL_DEL_TFEET

class defTFeet( object ):
    '''  删除tfeet    '''
    dbo = mysqldb()

    def POST( self ):
        """ 接受客户端post的消息 """
        data = web.input()
        res = None
        tfid = data.tfid
        
        if checkkey( web.config._session, web.ctx.env ):
            res = self.delTFeet( tfid )
        else:
            res = '{"msg":"203", "errmsg":"session验证未通过.","tfid":"%s"}' % str( tfid )

        return res


    def delTFeet( self, ai_tfid ):
        """ 删除tfeet """
        sql = SQL_DEL_TFEET % int( ai_tfid )

        row = self.dbo.execsql( sql )
        
        if row == -1:
            res = '{"msg":"202", "errmsg":"删除tfeet失败.","tfid":"%s"}' % str( ai_tfid )
        else:
            res = '{"msg":"200","tfid":"%s"}' % str( ai_tfid )
        
        return res

        
